<div id="news">
<h4> Menu </h4>
</div>
<?php
	$sql="SELECT * FROM menu where parent=0 ORDER BY pos DESC";
	$spql=$dp->QueryAll($sql);
?>
<table width="100%"  border="1" cellspacing="5" cellpadding="5">
	<tr>
		<td width="20" align="center" valign="middle"><strong>STT</strong></td>
		<td  align="center" ><strong>Tên Menu</strong></td>
		<td width="50" align="center" valign="middle"><strong>Ẩn/Hiện</strong></td>
		<td width="300" align="center" valign="middle"><strong>Link dẫn</strong></td>
		<td width="100" align="center" valign="middle"><strong>Cấp</strong></td>
		<td width="100" align="center" valign="middle"><strong>Loại_STT</strong></td>

	</tr>
	<?php 
		for($i=0;$i<count($spql);$i++)
		{
			$id=$spql[$i]['id'];
			$name=$spql[$i]['name'];
			$states=$spql[$i]['states'];
			$parent=$spql[$i]['parent'];
			if($spql[$i]['level']==1)
			{
				$parent="NAM";
			}
			if($spql[$i]['level']==3)
			{
				$parent="NU";
			}
			if($spql[$i]['states']==1)
			{
				$states="<img src='IMAGES/hien.png' />";
			}
			else
			{
				$states="<img src='IMAGES/an.png' />";
			}
			$link=$spql[$i]['link'];
			$level=$spql[$i]['level'];
				if($spql[$i]['level']==3)
			{
				$level="1";
			}
			
			$ordering=$spql[$i]['ordering'];
			
			
	?>
	<tr>
		<td width="20" align="center" valign="middle"><?php echo ($i+1); ?></td>
	     <td ><?php echo $name; ?></td>
		<td align="center"> <a href="index.php?option=menu&cat=states&id=<?php echo $id?>">
			<?php echo $states;?>
			</a></td>
		
		<td align="center"><?php echo $link;?></td>
		<td align="center"><?php echo $level;?></td>
		<td align="center"><?php echo $ordering;?></td>
	
	
	</tr>
	<?php
		}
	?>
</table>